import request from '@/utils/request'

const api_name = "/eduservice/course"

export default {

    //添加课程信息
    addCourseInfo(courseInfoDto) {
        return request({
            url: `/eduservice/course/saveCourseInfo`,
            method: 'post',
            data: courseInfoDto
        })
    },

    //根据id查询课程
    getCourseById(id) {
        return request({
            url: `${api_name}/getCourseInfoById/${id}`,
            method: 'get'
        })
    },

    //修改课程基本信息
    updateCourseInfo(courseInfoDto) {
        return request({
            url: `${api_name}/updateCourseInfo`,
            method: 'post',
            data: courseInfoDto
        })
    },

    //根据ID获取课程发布信息
    coursePublishInfoById(id) {
        return request({
            url: `${api_name}/coursePublishInfo/${id}`,
            method: 'get'
        })
    },

    //根据id发布课程
    publishCourse(id) {
        return request({
            url: `${api_name}/publishCourse/${id}`,
            method: 'put'
        })
    },

    //多条件查询 + 分页查询课程
    pageList(current, limit, courseQueryDto) {
        return request({
            url: `${api_name}/pageListCourseCondition/${current}/${limit}`,
            method: 'post',
            data: courseQueryDto
        })
    },

    //根据id删除课程
    deleteCourseId(course) {
        return request({
            url: `${api_name}/${course}`,
            method: 'delete'
        })
    }
}